test(install): add shellcheck + bats harness for prebake logic#166
Open
ganeshkumarashok wants to merge 1 commit into
Open
test(install): add shellcheck + bats harness for prebake logic#166ganeshkumarashok wants to merge 1 commit into
ganeshkumarashok wants to merge 1 commit into
Conversation
The prebake mode dispatch (build-only / install-skip-build / install), the dkms marker write/parse/validate, and the opportunistic fast-path fallback previously had no automated guard -- CI only ran `docker buildx build` (xuexu6666 review on #162). - make install.sh sourceable for unit tests: move set-flags + config/helper sources + EXIT trap into main(), guard main() behind BASH_SOURCE, extract purge_gpu_cache, parameterize config/modules paths. Behavior-preserving (execution still runs main()). - test/install.bats: 15 tests (marker write/parse/validate, fast-path fallback, target-kernel selection, all three dispatch modes). - ci.yaml: new lint-and-test job (shellcheck install.sh+entrypoint.sh, bats test/). Local: shellcheck clean, bats 15/15 pass. Signed-off-by: Ganeshkumar Ashokavardhanan <aganeshkumar@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an automated test harness for the prebake runtime logic introduced in #162. Previously the
mode dispatch (
build-only/install-skip-build/install), the dkms marker write/parse/validate,and the opportunistic fast-path fallback were only exercised by the cross-repo AgentBaker e2e — CI
here ran
docker buildx buildonly (no script execution, no shellcheck). This addresses that gap(xuexu6666's review comment on #162).
Changes
install.sh— made sourceable for unit testing, behavior-preserving:set -euxo pipefail, theconfig/helpersources, and the EXIT trap into a newmain()main()behindBASH_SOURCE(executes only when run directly; sourcing loads functions only)rm -r /opt/gpuintopurge_gpu_cacheAKSGPU_CONFIG_PATH/AKSGPU_MODULES_ROOT) for fixturesmain).test/install.bats— 15 tests: marker write/parse/validate (kernel/version/kind/missing-filemismatches),
fast_path_okfallback,target_build_kernelnewest-selection + fallback, and allthree dispatch modes.
.github/workflows/ci.yaml— newlint-and-testjob:shellcheckoninstall.sh+entrypoint.sh,and
bats test/.Validation
shellcheck -S warning install.sh entrypoint.sh— cleanbats test/install.bats— 15/15 passmainruns; sourcing → it does not)